﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Configuration;
using System.Web.Security;

/// <summary>
/// Summary description for BasePage
/// </summary>
public class BasePage : System.Web.UI.Page
{
    protected string connectionString = WebConfigurationManager.ConnectionStrings["DanhGiaGiaoVienConnectionString1"].ConnectionString;

    protected void Logout()
    {
        Session.Contents.RemoveAll();
        Response.Redirect("~/Login.aspx");
    }

    protected void ShowMessage(string mTextMsg, string mControlFocus)
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder("");
        sb.Append("<script language=\"JavaScript\">");
        if (mTextMsg != "") sb.Append(" alert('" + mTextMsg + "');");
        if (mControlFocus != "") sb.Append("document.forms[0].item('" + mControlFocus + "').focus();");
        sb.Append("</script>");
        if (!IsStartupScriptRegistered("setFocus")) RegisterStartupScript("setFocus", sb.ToString());
    }
}